{% extends 'base.html' %}

{% block title %}删除定时任务 - EasyTesting{% endblock %}

{% block header %}删除定时任务{% endblock %}

{% block content %}
<div class="card">
    <div class="card-body">
        <div class="alert alert-warning">
            <h5><i class="bi bi-exclamation-triangle"></i> 确认删除</h5>
            <p>您确定要删除定时任务 "<strong>{{ task.name }}</strong>" 吗？</p>
            <p class="mb-0"><strong>注意：</strong>此操作不可撤销，所有相关的执行日志也将被删除。</p>
        </div>

        <div class="row">
            <div class="col-md-6">
                <h6>任务信息</h6>
                <table class="table table-sm">
                    <tr>
                        <th width="30%">任务名称:</th>
                        <td>{{ task.name }}</td>
                    </tr>
                    <tr>
                        <th>测试套件:</th>
                        <td>{{ task.test_suite.name }}</td>
                    </tr>
                    <tr>
                        <th>执行环境:</th>
                        <td>{{ task.environment.name }}</td>
                    </tr>
                    <tr>
                        <th>调度类型:</th>
                        <td>{{ task.get_schedule_type_display }}</td>
                    </tr>
                </table>
            </div>
            <div class="col-md-6">
                <h6>执行统计</h6>
                <table class="table table-sm">
                    <tr>
                        <th width="30%">总执行次数:</th>
                        <td>{{ task.total_runs }}</td>
                    </tr>
                    <tr>
                        <th>成功次数:</th>
                        <td class="text-success">{{ task.successful_runs }}</td>
                    </tr>
                    <tr>
                        <th>失败次数:</th>
                        <td class="text-danger">{{ task.failed_runs }}</td>
                    </tr>
                    <tr>
                        <th>成功率:</th>
                        <td>{{ task.success_rate|floatformat:1 }}%</td>
                    </tr>
                </table>
            </div>
        </div>

        <div class="d-flex justify-content-between mt-4">
            <a href="{% url 'scheduled_task_detail' pk=task.pk %}" class="btn btn-secondary">
                <i class="bi bi-arrow-left"></i> 取消
            </a>
            <form method="post" style="display: inline;">
                {% csrf_token %}
                <button type="submit" class="btn btn-danger">
                    <i class="bi bi-trash"></i> 确认删除
                </button>
            </form>
        </div>
    </div>
</div>
{% endblock %}
